package org.budo.filestore.impl;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.Serializable;

import org.budo.filestore.api.UploadRequest;

import lombok.Getter;
import lombok.Setter;

/**
 * @author lmw
 */
@Getter
@Setter
public class DefaultUploadRequest extends AbstractRequest implements UploadRequest, Serializable {
    private static final long serialVersionUID = -8436783179779430562L;

    private InputStream inputStream;

    public DefaultUploadRequest() {}

    public DefaultUploadRequest(String contentUrl, InputStream inputStream) {
        this.inputStream = inputStream;
        this.setContentUrl(contentUrl);
    }

    public DefaultUploadRequest(String contentUrl, byte[] bytes) {
        this(contentUrl, new ByteArrayInputStream(bytes));
    }

    @Override
    public String toString() {
        return super.toString() //
                + ", contentUrl=" + this.getContentUrl() //
                + ", inputStream=" + this.getInputStream();
    }
}
